package com.le.tester.book.concurrentjavafight.l_13;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;

/**
 * createTime：2024/5/11 13:33
 * description：Lock接口.ReentrantLock不能完全替代synchronized的原因：当程序的执行控制离开被保护的代码块时，不会自动清除锁，
 * reentrantLock需要在finally中释放锁的资源
 */
public interface Lock {
    void lock();

    void lockInterruptibly() throws InterruptedException;

    boolean tryLock();

    boolean tryLock(long timeOut, TimeUnit timeUnit) throws InterruptedException;

    void unLock();

    Condition newCondition();

}
